package com.lipeng.service.impl;




import com.lipeng.bean.Comment;
import com.lipeng.bean.Photo;
import com.lipeng.mapper.CommentMapper;
import com.lipeng.mapper.PhotoMapper;
import com.lipeng.service.PhotoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * Created by dllo on 18/3/8.
 */
@Service
public class PhotoServiceImpl implements PhotoService {
    @Resource
    private PhotoMapper photoMapper;
    @Resource
    private CommentMapper commentMapper;

    @Override
    public List<Photo> findAllPhoto() {
        return photoMapper.findAllPhoto();
    }

    @Override
    public List<Photo> selectPhotoByName(String name) {
        return photoMapper.selectPhotoByName(name);
    }

    @Override
    public int deletePhotoById(Integer pid) {
        return photoMapper.deleteByPrimaryKey(pid);
    }

    @Override
    public Photo selectPhotoById(Integer pid){
        return photoMapper.selectByPrimaryKey(pid);
    }

    @Override
    public List<Comment> selectCommentByPid(Integer pid) {
        return commentMapper.selectCommentByPid(pid);
    }

    @Override
    public int addPhoto(Photo photo) {
        return photoMapper.insert(photo);
    }

    @Override
    public List<Photo> selectPhotoByUid(Integer uid) {
        return photoMapper.selectPhotoByUid(uid);
    }
}
